#include "UdpServer.hpp"
#include <cstdlib>
#include "Dict.hpp"

// 给出 端口号
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        std::cout << "Please use: " << argv[0] << " PORT" << endl;
    }
    else
    {
        Dict dict;
        dict.LoadDict();
        uint16_t port = stoi(argv[1]); // 注：字符串转整数
        udpserver us(port, [&dict](std::string word)
                     { return dict.Translate(word); });
        us.Init();
        us.Start();
    }
}